﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
	<meta charset="utf-8" />
    <script src="../scripts/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
        function myClick1() {
            var name = $('#txtUserName').val();
            var pwd = $('#txtpwd').val();
            sessionStorage.setItem("k_name", name);
            sessionStorage.setItem("k_pwd", pwd);
            alert("存储成功");
        }
        function myClick2() {
            alert(sessionStorage.getItem("k_name") + "|" + sessionStorage.getItem("k_pwd"));
        }
        function mylocal() {
            var name = $('#txtUserName').val();
            var pwd = $('#txtpwd').val();
            localStorage.setItem("k_name", name);
            localStorage.setItem("k_pwd", pwd);
            alert("存储成功");
        }
        function mylocalDisplay() {
            alert(localStorage.getItem("k_name") + "|" + localStorage.getItem("k_pwd"));
        }
    </script>
</head>
<body>
    <input type="text" id="txtUserName" />
    <input type="password" id="txtpwd" />
    <input type="button" onclick="myClick1()" value="存储" />
    <input type="button" onclick="myClick2()" value="显示" />
    <input type="button" onclick="mylocal()" value="local存储" />
    <input type="button" onclick="mylocalDisplay()" value="locak显示" />
</body>
</html>
